package day14.CountDownLatchDemo01;

import java.util.concurrent.CountDownLatch;

/**
 * @author Xiao
 * @date 2021/8/8
 */
public class MotherThread implements Runnable{
    private CountDownLatch cd;
    public MotherThread(CountDownLatch cd) {
        this.cd = cd;
    }
    @Override
    public void run() {
        //等待
        try {
            //当计数器为0的时候，自动唤醒这里等待的线程
            cd.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //收拾碗筷
        System.out.println(Thread.currentThread().getName() + "洗碗了。。。");
    }
}
